﻿@model IEnumerable<WeProjectsModel.Document>

@{
    ViewBag.Title = "Index";
    int usrId=int.Parse(Membership.GetUser().ProviderUserKey.ToString());
}

<h2>文档库</h2>

<p><span></span>上传文档：</p>
@using (Html.BeginForm("Upload", "Document", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <p>
        <input type="hidden" name="id" value=@Html.ViewContext.RouteData.Values["id"] />
        <input type="hidden" name="project" value="" />
        <input type="file" name="uploadFile" />
        <input type="hidden" name="backURL" value="Index" />
        <input type="hidden" name="isTask" value="0" />
        <input type="submit" name="Submit" id="Submit" value="上传" />
    </p>
}
<table class="table">
    <tr>
        <th></th>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Size) KB
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UploadDateTime)
        </th>
        @*<th>
                @Html.DisplayNameFor(model => model.Member.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Project.Title)
            </th>*@
        <th>操作</th>
    </tr>
    @{int rowNo = 0;}
    @foreach (var item in Model.Where(i => i.Member.Name == User.Identity.Name))
    {
        <tr>
            <td>@(++rowNo)</td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Size)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UploadDateTime)
            </td>
            @*<td>
                    @Html.DisplayFor(modelItem => item.Member.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Project.Title)
                </td>*@
            <td>
                @*@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |*@
                @Html.ActionLink("下载", "DownloadFile", new { file = item.ID, uploader = usrId }, new { @class = "btn btn-success btn-small" })&nbsp;
                @Html.ActionLink("删除", "Delete", new { id = item.ID }, new { @class = "btn btn-danger btn-small" })
            </td>
        </tr>
    }

</table>
